package com.jinsi.service.ylt.iml;

import com.jinsi.mapper.ylt.InfoCouponMapper;
import com.jinsi.service.ylt.InfoCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName InfoCouponServiceImpl
 * @Content 优惠劵统计展示数据业务层
 * @Author 姚龙腾
 * @Date 2022/10/12 11:53
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class InfoCouponServiceImpl implements InfoCouponService {

    @Autowired
    private InfoCouponMapper infoCouponMapper;

    /**
     * 获取每个优惠劵类型的数量
     * @return List<Integer>
     */
    @Override
    @Transactional(readOnly = true)
    public List<Integer> getCouponCount() {
        List<Integer> list = new ArrayList<>();
        list.add(infoCouponMapper.getCouponCount("商品"));
        list.add(infoCouponMapper.getCouponCount("视频"));
        list.add(infoCouponMapper.getCouponCount("无限制"));
        return list;
    }
}
